//
//  YMCategoryVC.swift
//  AllClassDemo
//
//  Created by zeng on 2018/2/27.
//  Copyright © 2018年 youmy. All rights reserved.
//

import UIKit

let kScreenH = UIScreen.main.bounds.size.height
let kScreenW = UIScreen.main.bounds.size.width

class YMCategoryVC: UIViewController {
    
    fileprivate let titles = ["智能手机","电脑平板","智能硬件","智能家电"]
    fileprivate let leftTitles = ["苹果","OPPO","VIVO","华为","三星","坚果","一加","小米","魅族","美图"]
    
    fileprivate lazy var leftTitleV: YMLeftTitleView = {
        let frame = CGRect(x: 0, y: 0, width: 75, height: ym_screen_height)
        let leftTitleV = YMLeftTitleView(frame: frame, titles: leftTitles)
        leftTitleV.delegate = self
        return leftTitleV
    }()
    
    fileprivate lazy var rightContentV: YMRightContentView = {
        let x = leftTitleV.frame.maxX
        let y = leftTitleV.frame.minY
        let rightContentV = YMRightContentView(frame: CGRect(x: x, y: y, width: ym_screen_width - x , height: ym_screen_height - y))
        return rightContentV
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.addSubview(leftTitleV)
        
        view.addSubview(rightContentV)
    }
}

extension YMCategoryVC: YMLeftTitleViewDelegate {
    func titleView(leftTitleView: YMLeftTitleView, didSelectRow: Int, title: String) {
        print("点击左标题：\(didSelectRow):"+title)
        rightContentV.updata(title)
    }
}
